// 定义状态
const initState = {
    cartNum: 0
}

// action
export function updateCart(payload) {
    return {
        type: 'CART_UPDATE_CART',
        payload
    }
}

// reducer修改state的值  
export default (state=initState,action)=> {
    switch(action.type) {
        case 'CART_UPDATE_CART':
            return {
                ...state,
                cartNum: action.payload
            }
        default: 
            return state;    
    }
}